home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: in2.uu.net!world!mv!usenet
- From: ENGR@GSSI.MV.COM (Michael Furman)
- Subject: Re: Leap year
- Message-ID: <DoJ0ny.IHC@mv.mv.com>
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- Organization: GSSI
- Date: Tue, 19 Mar 1996 17:59:58 GMT
- References: <3135A7F2.2120@hiwaay.net> <4hbiln$899@sam.inforamp.net> <65AVgFvrnTB@softsite.co.at>
- X-Newsreader: WinVN 0.99.7
- X-Nntp-Posting-Host: gssi.mv.com
-
- In article <65AVgFvrnTB@softsite.co.at>, wsog@softsite.co.at says...
- >
- >Poul A. Costinsky (PoulACost@msn.com) wrote on 13.03.96
- >about "Re: Leap year":
- >
- >> return (!(y % 4) && (y % 100));
- >>
- >> Hope this helps.
- >
- >No, Poul, it don't think it helps him much if you post nonsense.
- >Please read the FAQ before posting.
-
- It is better do not comment at all then post such comment! What FAQ you
- suggest to read? There is nothing about that in C++ FAQ.
-
- That is true that Poul's answer is not correct; for definition of leap
- years see homepage:
- http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html
-
- that contains a Summary of the International Standard Date and
- Time Notation:
-
- Leap years are years with an additional day YYYY-02-29, where the year number
- is a multiple of four with the
- following exception: If a year is a multiple of 100, then it is only a leap
- year if it is also a multiple of 400. For
- example, 1900 was not a leap year, but 2000 is one.
- ===== End of citation ======
-
- So, correct code would be:
- return (!(y % 4) && (!(y % 400) || (y % 100)));
-
- --
- <<< If you received it by E-mail: it is a copy of post to the newsgroup >>>
- ---------------------------------------------------------------
- Michael Furman, (603)893-1109
- Geophysical Survey Systems, Inc. fax:(603)889-3984
- 13 Klein Drive - P.O. Box 97 engr@gssi.mv.com
- North Salem, NH 03073-0097 71543.1334@compuserve.com
- ---------------------------------------------------------------
-
-